<?php
/**
 * Copyright (c) 2011 Jakob Sack <mail@jakobsack.de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

/**
 * This class contains all hooks.
 */
class OC_Calendar_Hooks{
   /**
    * @brief Creates default calendar for a user
    * @param paramters parameters from postCreateUser-Hook
    * @return array
    */
   public static function createUser($parameters) {
      $calendar_model = new PCalendarModelCalendar();
      $calendar_model->addDefaultCalendars($parameters['uid']);

      return true;
   }

   /**
    * @brief Deletes all calendars of a certain user
    * @param paramters parameters from postDeleteUser-Hook
    * @return array
    */
   public static function deleteUser($parameters) {
      $calendar_model = new PCalendarModelCalendar();
      $calendars = $calendar_model->allCalendars($parameters['uid']);
      foreach($calendars as $calendar) {
         $calendar_model->deleteCalendar($calendar['id']);
      }

      return true;
   }
}
